package com.glsc.ngateway.common.api.platform.dto.system;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.DateSerializer;
import com.glsc.ngateway.common.api.common.utils.CommonUtils;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * @Author: zhaoxc
 * @Date: 2020/6/23 17:37
 * @Desc: 系统配置表
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@EqualsAndHashCode(callSuper = true)
public class SystemConfigDto extends BaseSystemConfigDto {


    private static final long serialVersionUID = 5146158506206837553L;

    @ApiModelProperty(value = "系统配置id")
    private Integer configId;

    //创建时间
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = DateSerializer.class)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")//json序列化实体类处理
    @ApiModelProperty(value = "创建时间")
    private Date createTime;


//    //将SystemConfig转换为SystemConfigLog
//    public SystemConfigLog toSystemConfigLog() {
//        SystemConfig systemConfig = this;
//        SystemConfigLog systemConfigLog = new SystemConfigLog();
//        BeanUtils.copyProperties(systemConfig, systemConfigLog);
//        return systemConfigLog;
//    }

    @Override
    public String toString() {
        return this.getClass().getSimpleName() + "{" + CommonUtils.getFiledString(this) + "}";
    }
}
